package controller;

import java.util.ArrayList;
import java.util.List;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;


import model.Model;


/*
 * Logs out by setting the "user" session attribute to null.
 * (Actions don't be much simpler than this.)
 */
public class UserLogoutAction extends Action {

	public UserLogoutAction(Model model) {
		
	}
	
	public String getName() { return "user-logout.do"; }

	public String perform(HttpServletRequest request,HttpServletResponse response) {
        HttpSession session = request.getSession(false);
        session.setAttribute("user",null);
        
        List<String> errors = new ArrayList<String>();
                
        errors.add("You are now logged out");
        return "user-login.do";
    }
}
